using System;
using System.Collections.Generic;
using System.Text;
using DAL;
using Utility;
using DTO;

namespace BUS
{
   public class tbtinhthanhBUS
    {
        public static tbtinhthanhcollection Get(string where,
        int pageindex,
        int pagesize,
        string orderby,
        string orderdirection,
        out int total)
        {
            tbtinhthanhDAL tinhthanhDAL = new tbtinhthanhDAL();
            return tinhthanhDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbtinhthanhcollection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbtinhthanhDAL tinhthanhDAL = new tbtinhthanhDAL();
            return tinhthanhDAL.Get(cri.Criter, 0, 0, tinhthanhcolumns.matinh.ToString(), OrderDirection.ASC.ToString(), out total);
        }
        public static tbtinhthanh GetByID(int iD)
        {
            int total = 0;
            Criteria cri = new Criteria();
            cri.add(Condition.AND, tinhthanhcolumns.matinh.ToString(), Condition.EQUAL, iD);
            tbtinhthanhDAL tinhthanhDAL = new tbtinhthanhDAL();
            tbtinhthanhcollection tinhthanhcollection = tinhthanhDAL.Get(cri.Criter,
                     0, 0, tinhthanhcolumns.matinh.ToString(), OrderDirection.ASC.ToString(), out total);
            if (tinhthanhcollection.Count > 0)
                return tinhthanhcollection[0];
            return null;
        }
    }
}
